﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Smartmanufact
{
    public partial class EditEnterPot : Form
    {

        public string originname = "";
        public string originrows = "";
        public string origincol = "";
        public EditEnterPot()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        public void Fill_Info()
        {
            textBox_name.Text = originname;
            textBox_colcount.Text = origincol;
            textBox_rowcount.Text = originrows;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string name = textBox_name.Text.Trim();
                int colcount = int.Parse(textBox_colcount.Text.Trim());
                int rowcount = int.Parse(textBox_rowcount.Text.Trim());
                if (name == "") { MessageBox.Show("货架名不能为空！"); return; }
                if(rowcount<=0 || colcount<=0)
                {
                    MessageBox.Show("行数或者列数不能小于等于0！");
                }
                MainView.mysql.excute_sql("update entrepotinfo set enterpotname='" + name + "',col_count='" + colcount.ToString() + "',row_count='" + rowcount.ToString() + "' where enterpotname='"+originname+"'");
                this.Dispose();
            }
            catch { }
        }

        private void EditEnterPot_Load(object sender, EventArgs e)
        {

        }
    }
}
